﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToRTR.CUiExportToRTRProgressHandler
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Windows.Input;


namespace DnProcessSimulateCommands.ExportToRTR{

public class CUiExportToRTRProgressHandler
{
  private double _stepSize;
  private double _maxValue = 200.0;
  private double _currentValue;
  private bool _isActive;
  private Action<double> _setValue;

  public CUiExportToRTRProgressHandler(double maxValue, Action<double> setValue)
  {
    this._maxValue = maxValue;
    this._setValue = setValue;
  }

  public void Reset()
  {
    this._isActive = false;
    this._setValue(0.0);
    Mouse.OverrideCursor = (Cursor) null;
  }

  public void Increment(int numberOfSteps = 1)
  {
    if (!this._isActive)
      return;
    this._currentValue += (double) numberOfSteps * this._stepSize;
    this._setValue(this._currentValue);
  }

  public void Start(double range, double stepSize)
  {
    this._stepSize = this._maxValue / (range / stepSize);
    this._isActive = true;
    this._currentValue = 0.0;
    Mouse.OverrideCursor = Cursors.Wait;
  }

  public void AddToRange(double addtionalRange, double stepSize)
  {
    if (!this._isActive)
      return;
    double num = this._currentValue / this._stepSize;
    this._stepSize = this._maxValue / ((this._maxValue / this._stepSize + addtionalRange) / stepSize);
    this._currentValue = num * this._stepSize;
  }
}
